package com.consumer.user.controller;

import com.consumer.user.service.ConsumerFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;
import java.util.Map;

/**
 * 类描述：文件上传实现类
 * @author linzf
 */
@RestController
@RequestMapping(value = "/file")
public class ConsumerFileController {

    @Autowired
    private ConsumerFileService consumerFileService;

    /**
     * 功能描述：实现文件上传
     * @param file
     * @return
     */
    @PostMapping(value = "uploadFile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public Map<String,Object> uploadFile(@RequestParam("file") MultipartFile file,
                                         @RequestParam("idImageType") String idImageType){
        return consumerFileService.uploadFile(file,idImageType);
    }

}
